﻿using BackOfficeApplication.Controlers;
using BackOfficeApplication.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BackOfficeApplication.Views
{
    public partial class ArticleUi : Form
    {
        public ArticleUi()
        {
            InitializeComponent();
        }
        public ArticleUi(ArticleCtrl ctrl)
            : this()
        {
            _ctrl = ctrl;

            BindingUI();
        }

        public void BindingUI()
        {
            Model = new ArticleModel();
            Model.Categories = _ctrl.GetCategories();

            articleModelBindingSource.DataSource = Model;
        }

        private ArticleCtrl _ctrl;
        private ImageCtrl _imageCtrl;
        public ArticleModel Model { get; set; }

        private void ResetClick(object sender, EventArgs e)
        {
            try
            {
                _ctrl.Reset();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "infomation", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }

        private void OpenImageWindow(object sender, EventArgs e)
        {
             _imageCtrl = new ImageCtrl(_ctrl);
        }

        private void OpenClipWindow(object sender, EventArgs e)
        {
            var clipCtrl = new ClipCtrl();
        }

        private void AddClick(object sender, EventArgs e)
        {
           // var image = _imageCtrl.GetModel();
        }
    }
}
